# This file combines the datasets from different sources to create the Bartik Instrument for Analysis

rm(list=ls()) 



# Import packages 
library(dplyr)
library(data.table)
library(lfe)
library(ggplot2)
library(stargazer)
`%notin%` <- Negate(`%in%`)

# Set the working directory of the replication package
wd="C:/Users/mg5797/Documents/Pollution/ReplicationPackage"
setwd(wd)


# Clean the Stanford Education Data and Merge with Pollution Data
source("Programs/PrepareData/1.mergeSEDA_pollution.R")

setwd("..")


# Prepare for the bartik instrument 
source("Programs/PrepareData/2_prepforbartik.R")
setwd(wd)

# Bartik instrument for 2005 shares

source("Programs/PrepareData/3a_createBartik2005.R")

# Bartik instrument for 2001 shares
setwd("..")
source("Programs/PrepareData/3b_createBartik2001.R")

